\(\int \tan ^2(a+b x) \, dx\) [53]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 8, antiderivative size = 14 \[ \int \tan ^2(a+b x) \, dx=-x+\frac {\tan (a+b x)}{b} \]

[Out]

-x+tan(b*x+a)/b

Rubi [A] (verified)

Time = 0.01 (sec) , antiderivative size = 14, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.250, Rules used = {3554, 8} \[ \int \tan ^2(a+b x) \, dx=\frac {\tan (a+b x)}{b}-x \]

[In]

Int[Tan[a + b*x]^2,x]

[Out]

-x + Tan[a + b*x]/b

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 3554

Int[((b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b*((b*Tan[c + d*x])^(n - 1)/(d*(n - 1))), x] - Dis
t[b^2, Int[(b*Tan[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1]

Rubi steps \begin{align*} \text {integral}& = \frac {\tan (a+b x)}{b}-\int 1 \, dx \\ & = -x+\frac {\tan (a+b x)}{b} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.01 (sec) , antiderivative size = 23, normalized size of antiderivative = 1.64 \[ \int \tan ^2(a+b x) \, dx=-\frac {\arctan (\tan (a+b x))}{b}+\frac {\tan (a+b x)}{b} \]

[In]

Integrate[Tan[a + b*x]^2,x]

[Out]

-(ArcTan[Tan[a + b*x]]/b) + Tan[a + b*x]/b

Maple [A] (verified)

Time = 0.06 (sec) , antiderivative size = 19, normalized size of antiderivative = 1.36

method result size
derivativedivides \(\frac {\tan \left (b x +a \right )-b x -a}{b}\) \(19\)
default \(\frac {\tan \left (b x +a \right )-b x -a}{b}\) \(19\)
risch \(-x +\frac {2 i}{b \left ({\mathrm e}^{2 i \left (b x +a \right )}+1\right )}\) \(24\)
norman \(\frac {x -\frac {2 \tan \left (\frac {b x}{2}+\frac {a}{2}\right )}{b}-x \left (\tan ^{2}\left (\frac {b x}{2}+\frac {a}{2}\right )\right )}{\tan ^{2}\left (\frac {b x}{2}+\frac {a}{2}\right )-1}\) \(47\)
parallelrisch \(\frac {-\left (\tan ^{2}\left (\frac {b x}{2}+\frac {a}{2}\right )\right ) x b +b x -2 \tan \left (\frac {b x}{2}+\frac {a}{2}\right )}{b \left (\tan ^{2}\left (\frac {b x}{2}+\frac {a}{2}\right )-1\right )}\) \(50\)

[In]

int(sec(b*x+a)^2*sin(b*x+a)^2,x,method=_RETURNVERBOSE)

[Out]

1/b*(tan(b*x+a)-b*x-a)

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 31 vs. \(2 (14) = 28\).

Time = 0.28 (sec) , antiderivative size = 31, normalized size of antiderivative = 2.21 \[ \int \tan ^2(a+b x) \, dx=-\frac {b x \cos \left (b x + a\right ) - \sin \left (b x + a\right )}{b \cos \left (b x + a\right )} \]

[In]

integrate(sec(b*x+a)^2*sin(b*x+a)^2,x, algorithm="fricas")

[Out]

-(b*x*cos(b*x + a) - sin(b*x + a))/(b*cos(b*x + a))

Sympy [F]

\[ \int \tan ^2(a+b x) \, dx=\int \sin ^{2}{\left (a + b x \right )} \sec ^{2}{\left (a + b x \right )}\, dx \]

[In]

integrate(sec(b*x+a)**2*sin(b*x+a)**2,x)

[Out]

Integral(sin(a + b*x)**2*sec(a + b*x)**2, x)

Maxima [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 18, normalized size of antiderivative = 1.29 \[ \int \tan ^2(a+b x) \, dx=-\frac {b x + a - \tan \left (b x + a\right )}{b} \]

[In]

integrate(sec(b*x+a)^2*sin(b*x+a)^2,x, algorithm="maxima")

[Out]

-(b*x + a - tan(b*x + a))/b

Giac [A] (verification not implemented)

none

Time = 0.41 (sec) , antiderivative size = 18, normalized size of antiderivative = 1.29 \[ \int \tan ^2(a+b x) \, dx=-\frac {b x + a - \tan \left (b x + a\right )}{b} \]

[In]

integrate(sec(b*x+a)^2*sin(b*x+a)^2,x, algorithm="giac")

[Out]

-(b*x + a - tan(b*x + a))/b

Mupad [B] (verification not implemented)

Time = 0.09 (sec) , antiderivative size = 14, normalized size of antiderivative = 1.00 \[ \int \tan ^2(a+b x) \, dx=\frac {\mathrm {tan}\left (a+b\,x\right )}{b}-x \]

[In]

int(sin(a + b*x)^2/cos(a + b*x)^2,x)

[Out]

tan(a + b*x)/b - x